<script setup lang='ts'>
import { ref } from 'vue';
import child from './子组件.vue'

const username = ref('张三')
const age = ref(20)

const changeInfo = () => {
    username.value = 'wangwu'
    age.value++
}
const updateAge = () => {
    age.value++
}

const updateAge1 = (count: number) => {
    age.value = count
}
</script>

<template>
    <div>
        <h1>父组件</h1>
        <p>姓名：{{ username }}</p>
        <p>年龄：{{ age }}</p>
        <button @click="changeInfo">修改内容</button>
        <child :name="username" :age="age" :fun="updateAge" @update-age="updateAge1"></child>
    </div>

</template>

<style scoped></style>